<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/resources/logo.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>GraphiQL</title>
    <style>
      body {
        margin: 0;
      }

      #graphiql {
        height: 100dvh;
      }

      .loading {
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 4rem;
      }
    </style>
    <!--vite-replace-start-->
    <link href="/dist/style.css" rel="stylesheet" />
    <script
      crossorigin
      src="https://unpkg.com/react@18/umd/react.production.min.js"
    ></script>
    <script
      crossorigin
      src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"
    ></script>
    <script type="module">
      /**
       * Setup workers for GraphiQL UMD bundle
       */
      function getWorkerUrl(label) {
        switch (label) {
          case 'json':
            return '/dist/workers/json.worker.js';
          case 'graphql':
            return '/dist/workers/graphql.worker.js';
        }
        return '/dist/workers/editor.worker.js';
      }

      globalThis.MonacoEnvironment = {
        // `MonacoEnvironment.getWorkerUrl` throws Uncaught SyntaxError: Unexpected token 'export',
        // we use` MonacoEnvironment getWorker` instead
        getWorker(_workerId, label) {
          console.log('setup workers in cdn');
          const url = new URL(getWorkerUrl(label), import.meta.url);
          return new Worker(url, { type: 'module' });
        },
      };
    </script>
    <script src="/dist/index.umd.js"></script>
    <script type="module" src="/dist/e2e.js"></script>
    <!--vite-replace-end-->
  </head>
  <body>
    <div id="graphiql">
      <div class="loading">Loading…</div>
    </div>
  </body>
</html>
